/*
// Definition for a Node.
class Node {
public:
    int val;
    vector<Node*> children;

    Node() {}

    Node(int _val) {
        val = _val;
    }

    Node(int _val, vector<Node*> _children) {
        val = _val;
        children = _children;
    }
};
*/

class Solution {
public:
    void prosess(Node* cur, vector<int>& result){
        if(cur == NULL) return; //  确定递归终止条件
        result.push_back(cur->val);
        for(int i = 0; i < cur->children.size(); i++){
           if(cur->children[i])  prosess(cur->children[i], result);
        }
    }
    vector<int> preorder(Node* root) {
        vector<int> result;
        prosess(root, result); 
        return result;
    }
};
